package com.ywk.miaohsa.redis;

public class BasePrefix implements KeyPrefix {

    private int expireSeconds;//缓存有效期

    private String prefix;

    public BasePrefix(){}


    public BasePrefix(int expireSeconds,String prefix){
        this.expireSeconds=expireSeconds;
        this.prefix=prefix;
    }

    public void setExpireSeconds(int expireSeconds) {
        this.expireSeconds = expireSeconds;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    @Override
    public int getExpireSeconds() {
        return expireSeconds;
    }

    @Override
    public String getPrefix() {
        String className=this.getClass().getSimpleName();
        return className+":"+prefix;
    }

    @Override
    public String toString() {
        return "BasePrefix{" +
                "expireSeconds=" + expireSeconds +
                ", prefix='" + prefix + '\'' +
                '}';
    }
}
